import { Tools } from 'weaver-mobile';
import { catchApiError } from '../util/index';

// 获取微搜基础信息
export const getBaseData = (params) => {
  let options = {
    method: 'POST',
    url: '/api/fullsearch/base/getBaseData',
    params: {...params, ismobile: 1,sourceType: 'MOBILE'}
  };
  return Tools.callApi(options).then(catchApiError);
}

// 按条件搜索
export const doSearch = (params) => {
  let options = {
    method: 'POST',
    url: '/api/fullsearch/mobile/search',
    params: {...params, ismobile: 1}
  };
  return Tools.callApi(options).then(catchApiError);
}
// 微搜结果提交
export const submitResult = (params) => {
  let options = {
    method: 'POST',
    url: '/api/fullsearch/serveset/submitResult',
    params: {...params, ismobile: 1}
  };
  return Tools.callApi(options).then(catchApiError);
}
// 微搜提交按钮显隐
export const showSubmit = (params) => {
  let options = {
    method: 'POST',
    url: '/api/fullsearch/serveset/showSubmit',
    params: {...params, ismobile: 1}
  };
  return Tools.callApi(options).then(catchApiError);
}

// 高级搜索
export const getAdvancedForm = (params) => {
  let options = {
    method: 'POST',
    url: '/api/meeting/field/getMeetingBaseFieldMobx',
    params: {...params, ismobile: 1}
  };
  return Tools.callApi(options).then(catchApiError);
}

// 常用条件设置
export const getCommonSetForms = (params) => {
  let options = {
    method: 'POST',
    url: '/api/workplan/calendar/getAttentionData',
    params: {...params, ismobile: 1}
  };
  return Tools.callApi(options).then(catchApiError);
}

// 添加常用条件设置
export const getSearchTagDtl = (params) => {
  let options = {
    method: 'POST',
    url: '/api/fullsearch/custompage/getSearchTagDtl',
    params: {...params, ismobile: 1}
  };
  return Tools.callApi(options).then(catchApiError);
}

export const getCustompageBaseDatas = (params) => {
  let options = {
    method: 'POST',
    url: '/api/fullsearch/custompage/getBaseData',
    params: {...params, ismobile: 1}
  };
  return Tools.callApi(options).then(catchApiError);
}

//删除历史搜索条件
export const delHistorySearch = (params) => {
  let options = {
    method: 'POST',
    url: '/api/fullsearch/custompage/delHistorySearch',
    params: {...params, ismobile: 1}
  };
  return Tools.callApi(options).then(catchApiError);
}

//删除常用条件
export const delSearchTag = (params) => {
  let options = {
    method: 'POST',
    url: '/api/fullsearch/custompage/delSearchTag',
    params: {...params, ismobile: 1}
  };
  return Tools.callApi(options).then(catchApiError);
}

export const showAndHideSearchTag = (params) => {
  let options = {
    method: 'POST',
    url: '/api/fullsearch/custompage/showAndHideSearchTag',
    params: {...params, ismobile: 1}
  };
  return Tools.callApi(options).then(catchApiError);
}

export const doSaveSearchTag = (params) => {
  let options = {
    method: 'POST',
    url: '/api/fullsearch/custompage/doSaveSearchTag',
    params: {...params, ismobile: 1}
  };
  return Tools.callApi(options).then(catchApiError);
}

export const doSaveHistorySearch = (params) => {
  let options = {
    method: 'POST',
    url: '/api/fullsearch/custompage/doSaveHistorySearch',
    params: {...params, ismobile: 1}
  };
  return Tools.callApi(options).then(catchApiError);
}